/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.edu.ufcg.boombox.base;

import br.edu.ufcg.boombox.controller.CadastroUsuarioController;
import br.edu.ufcg.boombox.controller.ContextoDaAplicacao;
import br.edu.ufcg.boombox.controller.LoginController;
import br.edu.ufcg.boombox.controller.PaginaInicialBoomBoxController;
import br.edu.ufcg.boombox.model.RepositoryManager;
import br.edu.ufcg.boombox.view.CadastroUsuarioView;
import br.edu.ufcg.boombox.view.LoginView;
import br.edu.ufcg.boombox.view.PaginaInicialBoomBoxView;
import java.io.File;
import java.net.URL;

/**
 *
 * @author Targaryen
 */
public class Main {
    
    
    
    public static void main(String[] args) {
        
        
        
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(LoginView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(LoginView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(LoginView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(LoginView.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            @Override
            public void run() {
                //new LoginView().setVisible(true);
                RepositoryManager.getInstance();
        ContextoDaAplicacao contexto = ContextoDaAplicacao.getInstance();
        contexto.adicionarControlador("loginController", new LoginController(new LoginView()));
        contexto.adicionarControlador("cadastroUsuarioController", new CadastroUsuarioController(new CadastroUsuarioView()));
        contexto.getControlador("loginController").inicializar();
        contexto.adicionarControlador("paginaInicialBoomBoxController", new PaginaInicialBoomBoxController(new PaginaInicialBoomBoxView()));
//                System.out.println(getClass().getResource("/br/edu/ufcg/boombox/recurso/silhuetaMasculina.jpg"));
//                System.out.println(getClass().getResource("/br/edu/ufcg/boombox/recurso/silhuetaMasculina.jpg"));
//                System.out.println("");
//                //File file = new File("/br/edu/ufcg/boombox/recurso/silhuetaMasculina.jpg");
//                //File file = new File("../folder/x.dat");
//                
//                System.out.println(getClass().getProtectionDomain().getCodeSource().getLocation().getPath());
            }
        });
    }
    
}
